package com.ym521.imgcrop.base;

import androidx.annotation.DrawableRes;
import androidx.annotation.FloatRange;

import com.ym521.imgcrop.widget.RectCropView;

import java.io.Serializable;

/**
 * @author Ym
 * E-mail: 2435970206@qq.com
 * createTime:2023/12/29
 * explain:
 */
public class CropRequest implements Serializable {
    private float whRatio;
    private float widthRatio;
    private @DrawableRes int drawableRes;
    private String iamgePath;
    private int cropType;
    private String extra;

    private CropRequest(RectCropView.WHRatio whRatio, @FloatRange(from = 0.1, to = 0.9) float widthRatio, int drawableRes, String iamgePath, CropType cropType, String extra) {
        this.whRatio = whRatio.getRation();
        this.widthRatio = widthRatio;
        this.drawableRes = drawableRes;
        this.iamgePath = iamgePath;
        this.cropType = cropType.getType();
        this.extra = extra;
    }

    public CropRequest(RectCropView.WHRatio whRatio, @FloatRange(from = 0.1, to = 0.9) float widthRatio, int drawableRes, CropType cropType, String extra) {
        this(whRatio, widthRatio, drawableRes, null, cropType, extra);
    }

    public CropRequest(RectCropView.WHRatio whRatio, @FloatRange(from = 0.1, to = 0.9) float widthRatio, int drawableRes, CropType cropType) {
        this(whRatio, widthRatio, drawableRes, cropType, null);
    }


    public CropRequest(RectCropView.WHRatio whRatio, float widthRatio, String iamgePath, CropType cropType, String extra) {
        this(whRatio, widthRatio, 0, iamgePath, cropType, extra);
    }

    public CropRequest(RectCropView.WHRatio whRatio, float widthRatio, String iamgePath, CropType cropType) {
        this(whRatio, widthRatio, iamgePath, cropType, null);
    }

    public float getWhRatio() {
        return whRatio;
    }

    public void setWhRatio(RectCropView.WHRatio whRatio) {
        this.whRatio = whRatio.getRation();
    }

    public float getWidthRatio() {
        return widthRatio;
    }

    public void setWidthRatio(float widthRatio) {
        this.widthRatio = widthRatio;
    }

    public int getDrawableRes() {
        return drawableRes;
    }

    public void setDrawableRes(int drawableRes) {
        this.drawableRes = drawableRes;
    }

    public String getIamgePath() {
        return iamgePath;
    }

    public void setIamgePath(String iamgePath) {
        this.iamgePath = iamgePath;
    }

    public int getCropType() {
        return cropType;
    }

    public void setCropType(int cropType) {
        this.cropType = cropType;
    }

    public String getExtra() {
        return extra;
    }

    public void setExtra(String extra) {
        this.extra = extra;
    }

    @Override
    public String toString() {
        return "CropRequest{" +
                "whRatio=" + whRatio +
                ", widthRatio=" + widthRatio +
                ", drawableRes=" + drawableRes +
                ", iamgePath='" + iamgePath + '\'' +
                ", cropType=" + cropType +
                ", extra='" + extra + '\'' +
                '}';
    }
}
